<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
     
<script>
	require([ "dojo/json", 
	         "dojo/data/ObjectStore",
			"dojox/grid/enhanced/plugins/Pagination",
			"dojox/grid/enhanced/plugins/Filter", 
			"dojox/grid/EnhancedGrid",
			"dojox/data/JsonRestStore",
			"dojo/domReady!" ], function(JSON,
			ObjectStore, Pagination, Filter, EnhancedGrid, JsonRestStore) {
		var restStore = new dojox.data.JsonRestStore({
	        target: '' ,
	        service:'s'

		});
		var dataStore = dojo.data.ObjectStore({
			objectStore : restStore
		});
		
		 var store = new dojo.data.ItemFileReadStore({
        	url: "portal/part/grid1.json"
   		 });
    
		var setupFilter = function(commands, request) {
			if (commands.filter && commands.enable) {
				request.query = {
					"filter" : JSON.stringify(commands.filter)
				};
			} else {
				// no filter is valid.
			}
		};
		var grid = new dojox.grid.EnhancedGrid({
			id:'grid3',
			store : store,
			structure : [ {
				name : "id",
				field : "id",
				width : "auto"
			}, {
				name : "name",
				field : "name",
				width : "auto"
			}, {
				name : "old",
				field : "old",
				width : "auto"
			} ],
			columnReordering : true,
			clientSort : true,
			rowSelector : '20px',
			rowsPerPage : 5,
			autoHeight : true,
			plugins : {
				 pagination: {
             		 pageSizes: ["2", "50", "100", "All"],
             		 description: true,
             		 sizeSwitch: true,
             		 pageStepper: true,
            		  gotoButton: true,
            		          /*page step to be displayed*/
             		 maxPageStep: 4,
             		         /*position of the pagination bar*/
             		 position: "bottom"
         		 }

				,
				filter : {
					// Show the closeFilterbarButton at the filter bar  
					closeFilterbarButton : true,
					// Set the maximum rule count to 5     
					ruleCount : 5,
					// Set the name of the items    
					itemsName : "items",
					isServerSide : true,
					setupFilterQuery : setupFilter
				}
			}
		}, "gridContainer3");
		grid.startup();
	});
</script>
	<div id="gridContainer3"></div>
